<template>
  <div style="position: relative">
    <div class="content">
      <div class="info">
        <div class="title">{{ basicInfo.title }}</div>
        <div class="list">
          <div class="item">
            <div class="tit">创建时间</div>
            <div class="desc">{{ info.gmtCreated }}</div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            ></div>
          </div>
          <div class="item">
            <div class="tit">云尘付流水号</div>
            <div class="desc">{{ info.orderNo ? info.orderNo : "-" }}</div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            >
              <i
                v-if="info.orderNo"
                class="el-icon-document-copy"
                @click="copyAppId(info.orderNo)"
              ></i>
            </div>
          </div>
          <div class="item">
            <div class="tit">用户ID</div>
            <div class="desc">{{ info.userId }}</div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            ></div>
          </div>
          <div class="item">
            <div class="tit">用户名称</div>
            <div class="desc">
              {{ info.memberName ? info.memberName : "-" }}
            </div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            ></div>
          </div>
          <div class="item">
            <div class="tit">账务类型</div>
            <div class="desc">{{ setAccType(info.orderType) }}</div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            ></div>
          </div>

          <!-- <div
            class="item"
            v-for="(item, index) of basicInfo.infoList"
            :key="index"
          >
            <div class="tit">{{ item.title }}</div>
            <div class="desc">{{ item.data }}</div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            >
              <i
                class="el-icon-document-copy"
                v-if="item.copy"
                @click="copyAppId(item.data)"
              ></i>
            </div>
          </div> -->
        </div>
      </div>
      <div class="info" v-if="this.$route.query.type == 1 ? true : false">
        <div class="title">{{ payInfo.title }}</div>
        <div class="list">
          <div class="item">
            <div class="tit">账务类型</div>
            <div class="desc">{{ setAccType(info.orderType) }}</div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            ></div>
          </div>
          <div class="item">
            <div class="tit">支付渠道</div>
            <div class="desc">
              {{
                info.channelPayFormTypeName ? info.channelPayFormTypeName : "-"
              }}
            </div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            ></div>
          </div>
          <div class="item">
            <div class="tit">支付金额/元</div>
            <div class="desc">
              {{ info.fmtChangeAmount }}
            </div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            ></div>
          </div>
          <div class="item">
            <div class="tit">变动金额/元</div>
            <div class="desc">
              {{ info.streamType == "income" ? "+" : "-" }}
              {{ info.fmtActualityAmount }}
            </div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            ></div>
          </div>
          <div class="item">
            <div class="tit">手续费金额/元</div>
            <div class="desc">
              {{ info.fmtFeeAmount }}
            </div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            ></div>
          </div>
          <div class="item">
            <div class="tit">转出账户</div>
            <div class="desc">
              {{ info.outAccount ? info.outAccount : "-" }}
            </div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            ></div>
          </div>
          <div class="item">
            <div class="tit">转入账户</div>
            <div class="desc" v-if="info.orderType == 'settle' && info.streamType == 'payout'">
-
            </div>
            <div class="desc" v-else>
              {{ info.inAccount ? info.inAccount : "-" }}
            </div>
            <div
              style="
                margin-left: 32px;
                color: #03bfc6;
                line-height: 40px;
                cursor: pointer;
              "
            ></div>
          </div>
          <!-- <div
            class="item"
            v-for="(item, index) of payInfo.infoList"
            :key="index"
          >
            <div class="tit">{{ item.title }}</div>
            <div class="desc">{{ item.data }}</div>
          </div> -->
        </div>
      </div>
      <div class="info" v-else style="min-width: 800px">
        <div class="title">{{ merchantInfo.title }}</div>
        <div class="list" style="position: relative">
          <div
            class="item"
            v-for="(item, index) of merchantInfo.infoList"
            :key="index"
          >
            <div class="tit">{{ item.title }}</div>
            <div class="desc">{{ item.data }}</div>
          </div>
          <div
            style="
              position: absolute;
              right: 0;
              top: 10px;
              color: #03bfc6;
              cursor: pointer;
            "
            @click="openShow = !openShow"
          >
            {{ openShow ? "收起" : "展开" }}
          </div>
          <div v-if="openShow" style="margin-top: 20px">
            <tr class="openBox">
              <td>账务类型</td>
              <td>渠道</td>
              <td>变动金额/元</td>
              <td>转出账户</td>
              <td>转出账户</td>
            </tr>
            <div class="openBox1" v-for="(o, oIndex) in openList" :key="oIndex">
              <td>
                {{ o.type }}
              </td>
              <td>
                {{ o.channel }}
              </td>
              <td>
                {{ o.feeAmt }}
              </td>
              <td>
                {{ o.outAccount }}
              </td>
              <td>
                {{ o.inAccount }}
              </td>
              <!-- <td :class="o.result == 'success' ? 'succeed' : ''">
                {{ o.result == "success" ? "成功" : "失败" }}
              </td> -->
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="back" @click="backFn">
      <i class="el-icon-close"></i>
    </div>
    <div class="left">
      <el-breadcrumb separator=">" style="margin-bottom: 20px">
        <el-breadcrumb-item v-for="item of breadList" :key="item">{{
          item
        }}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
  </div>
</template>

<script>
export default {
  name: "balanceDetail",
  components: {},
  data() {
    return {
      openShow: false,
      breadList: [],
      info: {},
      basicInfo: {
        title: "基本信息",
        infoList: [
          {
            title: "创建时间",
            data: "2023-01-23 14:00",
          },
          {
            title: "云尘付流水号",
            data: "YC739008937420535",
            copy: "true",
          },
          {
            title: "用户ID",
            data: "937420535",
          },
          {
            title: "财务类型",
            data: "余额结算",
          },
          {
            title: "可用余额/元",
            data: "150.00",
          },
        ],
      },
      payInfo: {
        title: "变动明细",
        infoList: [
          {
            title: "是否多个收款方",
            data: "否",
          },
          {
            title: "用户ID",
            data: "38489",
          },
          {
            title: "收款账号",
            data: "ioweq@email.com",
          },
          {
            title: "收款名称",
            data: "陕西西高驾校",
          },
        ],
      },
      merchantInfo: {
        title: "变动明细",
        infoList: [
          {
            title: "是否多个变动方",
            data: "是",
          },
        ],
      },
      openList: [
        {
          type: "余额入账",
          channel: "汇付",
          feeAmt: "294.36",
          outAccount: "-",
          inAccount: "972038523435",
        },
        {
          type: "余额出账",
          channel: "汇付",
          feeAmt: "294.36",
          outAccount: "972038523435",
          inAccount: "972038523435",
        },
      ],
    };
  },
  created() {
    this.breadList = this.$route.meta.title;
    //console.log(this.$route.query.id);
    let id = this.$route.query.id;
    if (id) {
      this.$http
        .get("/api/merchant/settleBalanceDrawcash/getChangeById?id=" + id)
        .then((res) => {
          if (res.code === "0000") {
            //console.log(res.data);
            this.info = res.data;
          }
        });
    }
  },
  methods: {
    setAccType(val) {
      let str = "";
      switch (val) {
        case "order":
          str = "支付";
          break;
        case "refund":
          str = "退款";
          break;
        case "charge":
          str = "充值";
          break;
        case "transfer":
          str = "转账";
          break;
        case "withdrawal":
          str = "提现";
          break;
        case "settle":
          str = "余额结算";
          break;
      }
      return str;
    },
    backFn() {
      this.$backTo("/account/balance");
    },
    copyAppId(value) {
      const input = document.createElement("input"); // 创建input对象
      input.value = value; // 设置复制内容
      document.body.appendChild(input); // 添加临时实例
      input.select(); // 选择实例内容
      document.execCommand("Copy"); // 执行复制
      document.body.removeChild(input); // 删除临时实例
      this.$message.success("复制成功！");
    },
  },
};
</script>

<style scoped lang="scss">
.succeed {
  color: #07a555;
}
.content {
  min-height: 780px;
  padding: 160px 100px;
  display: flex;
  justify-content: start;
  flex-wrap: wrap;
  .info {
    width: 33.3%;
    min-width: 500px;
    margin-bottom: 40px;
    padding: 0 2%;
    .title {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #1d1c1c;
      padding-bottom: 15px;
      border-bottom: 1px solid #03bfc6;
    }
    .list {
      margin-top: 35px;
      .item {
        display: flex;
        .tit {
          min-width: 100px;
          margin-right: 32px;
          font-size: 14px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #869daa;
          line-height: 40px;
          text-align: right;
        }
        .desc {
          font-size: 14px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #1d1c1c;
          line-height: 40px;
        }
      }
      .openBox {
        margin-bottom: 20px;
        height: 22px;
        font-size: 15px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 600;
        color: #1d1c1c;
        line-height: 22px;
        display: flex;
        justify-content: start;
        td {
          display: inline-block;
          min-width: 16%;
          padding: 0 40px 0 0;
        }
      }
      .openBox1 {
        margin-bottom: 20px;
        height: 22px;
        font-size: 14px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 400;
        color: #1d1c1c;
        line-height: 22px;
        display: flex;
        justify-content: start;
        text-align: left;
        td {
          padding: 0 40px 0 0;
          min-width: 16%;
          width: 1px;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
      }
    }
  }
}
.back {
  position: absolute;
  right: 55px;
  top: 20px;
  font-size: 20px;
  cursor: pointer;
}
.left {
  position: absolute;
  left: 55px;
  top: 31px;
  height: 20px;
  font-size: 14px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #869daa;
  line-height: 20px;
}
// :deep(.el-table__expand-icon) {
//   // position: absolute;
//   // left:140px;
//   float: left;
// }
@media screen and (max-width: 1770px) {
  .content {
    .info {
      box-sizing: content-box !important;
      width: 33.3%;
      min-width: 520px;
      margin-bottom: 40px;
      padding: 0 5.5%;
    }
  }
}

@media screen and (max-width: 1550px) {
  .content {
    .info {
      box-sizing: content-box !important;
      width: 33.3%;
      min-width: 488px;
      margin-bottom: 40px;
      padding: 0 2%;
    }
  }
}
</style>
